<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

	<title>个人资料</title>

	<link href="/static/home/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
	<link href="/static/home/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

	<link href="/static/home/css/personal.css" rel="stylesheet" type="text/css">
	<link href="/static/home/css/infstyle.css" rel="stylesheet" type="text/css">
	<script src="/static/home/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
	<script src="/static/home/AmazeUI-2.4.2/assets/js/amazeui.js"></script>

	<script language="javascript" src="/static/home/js/YMDClass.js"></script>
</head>

<body>
<!--头 -->
<header>
	<article>
		<div class="mt-logo">
			<!--顶部导航条 -->
			<div class="am-container header">
				<!--<ul class="message-l">
					<div class="topMessage">
						<div class="menu-hd">
							<a href="#" target="_top" class="h">亲，请登录</a>
							<a href="#" target="_top">免费注册</a>
						</div>
					</div>
				</ul>-->
				<ul class="message-r">
					<div class="topMessage home">
						<div class="menu-hd"><a href="/index/index/index" target="_top" class="h">商城首页</a></div>
					</div>
					<div class="topMessage my-shangcheng">
						<div class="menu-hd MyShangcheng"><a href="/index/person/index" target="_top"><i
							class="am-icon-user am-icon-fw"></i>个人中心</a></div>
					</div>
					<div class="topMessage mini-cart">
						<div class="menu-hd"><a id="mc-menu-hd" href="#" target="_top"><i
							class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong id="J_MiniCartNum"
																								  class="h"></strong></a>
						</div>
					</div>
					<div class="topMessage favorite">
						<div class="menu-hd"><a href="#" target="_top"><i
							class="am-icon-heart am-icon-fw"></i><span>收藏夹</span></a></div>

					</div>
					<a href="/index/index/loginout" style="float: right; margin-top: 8px"> 退出</a>
				</ul>
			</div>

			<!--悬浮搜索框-->

			<div class="nav white">
				<div class="logoBig">
					<li><img src="/static/home/images/logobig.png"/></li>
				</div>

				<div class="search-bar pr">
					<a name="index_none_header_sysc" href="#"></a>
					<form>
						<input id="searchInput" name="index_none_header_sysc" type="text" placeholder="搜索"
							   autocomplete="off">
						<input id="ai-topsearch" class="submit am-btn" value="搜索" index="1" type="submit">
					</form>
				</div>
			</div>

			<div class="clear"></div>
		</div>
		</div>
	</article>
</header>
<!-- <div class="nav-table">
			<div class="long-title"><span class="all-goods">全部分类</span></div>
			<div class="nav-cont">
				 <ul>
					 <li class="index"><a href="#">首页</a></li>
					 <li class="qc"><a href="#">闪购</a></li>
					 <li class="qc"><a href="#">限时抢</a></li>
					 <li class="qc"><a href="#">团购</a></li>
					 <li class="qc last"><a href="#">大包装</a></li>
				 </ul>
				 <div class="nav-extra">
					 <i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>我的福利
					 <i class="am-icon-angle-right" style="padding-left: 10px;"></i>
				 </div>
			 </div>
 </div>-->
<b class="line"></b>
<div class="center">
	<div class="col-main">
		<div class="main-wrap">

			<div class="user-info">
				<!--标题 -->
				<div class="am-cf am-padding">
					<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">个人资料</strong> /
						<small>Personal&nbsp;information</small>
					</div>
				</div>
				<hr/>

				<!--头像 -->
				<div class="user-infoPic">

					<div class="filePic">
						<input type="file" class="inputPic" allowexts="gif,jpeg,jpg,png,bmp" accept="image/*">
						<img class="am-circle am-img-thumbnail" src="/static/home/images/getAvatar.do.jpg" alt=""/>
					</div>

					<p class="am-form-help">头像</p>

					<div class="info-m">
						<div><b>用户名：<i>{$infoData['username']}</i></b></div>
						<div class="vip">
							<span></span><a href="#">会员专享</a>
						</div>
					</div>
				</div>

				<!--个人信息 -->
				<div class="info-main">
					<form class="am-form am-form-horizontal" style="overflow: auto" enctype="multipart/form-data" method="post" action="/index/person/information">

						<div class="am-form-group">
							<label for="user-name1" class="am-form-label">用户名</label>
							<div class="am-form-content">
								<input type="text" id="user-name1" placeholder="用户名"
									   value="{$infoData['username']}"
								>
								<span id="user-name1Tip"></span>
							</div>
						</div>

						<div class="am-form-group">
							<label for="user-name" class="am-form-label">姓名</label>
							<div class="am-form-content">
								<input type="text" id="user-name2" placeholder="姓名"
									   value="{$infoData['realname']}"
								>
								<span id="user-name2Tip"></span>
							</div>
						</div>

						<div class="am-form-group">
							<label class="am-form-label">性别</label>
							<div class="am-form-content sex">
								<label class="am-radio-inline">
									<input type="radio" name="radio10" value="male" data-am-ucheck
										   {if $infoData['sex'] == 1}
									checked
									{/if}
									/>
									男
								</label>
								<label class="am-radio-inline">
									<input type="radio" name="radio10" value="female" data-am-ucheck
										   {if $infoData['sex'] == 2}
									checked
									{/if}
									> 女
								</label>
								<label class="am-radio-inline">
									<input type="radio" name="radio10" value="secret" data-am-ucheck
										   {if $infoData['sex'] == 0}
									checked
									{/if}
									> 保密
								</label>
							</div>
						</div>
						<div class="am-form-group">
							<label for="user-birth" class="am-form-label">生日</label>

							<div class="am-form-content birth">
								<div class="birth-select">
									<select name="year1" data-am-selected id="year"></select>
								</div>
								<div class="birth-select2">
									<select name="month1" data-am-selected id="month"></select></div>
								<div class="birth-select2">
									<select name="day1" data-am-selected id="day"></select></div>
							</div>

							<script>
                                new YMDselect('year1', 'month1', 'day1', {$infoData['year']}, {$infoData['month']}, {$infoData['day']});
							</script>

							<span id="birthTip"></span>
						</div>
						<div class="am-form-group">
							<label for="user-phone" class="am-form-label">电话</label>
							<div class="am-form-content">
								<input id="user-phone" placeholder="telephonenumber" type="tel"
									   value={$infoData['tel']}
								>
								<span id="telTip"></span>
							</div>
						</div>
						<div class="am-form-group">
							<label for="user-email" class="am-form-label">电子邮件</label>
							<div class="am-form-content">
								<input id="user-email" placeholder="Email" type="email"
									   value={$infoData['email']}
								>
<span id="emailTip"></span>
							</div>
						</div>
						<div class="am-form-group address">
							<label for="user-address" class="am-form-label">收货地址</label>
							<div class="am-form-content address">
								<a href="/index/person/address">
									<p class="new-mu_l2cw">
										<span class="province">湖北</span>省
										<span class="city">武汉</span>市
										<span class="dist">洪山</span>区
										<span class="street">雄楚大道666号(中南财经政法大学)</span>
										<span class="am-icon-angle-right"></span>
									</p>
								</a>

							</div>
						</div>
						<div class="am-form-group safety">
							<label for="user-safety" class="am-form-label">账号安全</label>
							<div class="am-form-content safety">
								<a href="/index/person/password">
									<span class="am-icon-angle-right"></span>
								</a>

							</div>
						</div>
						<div class="info-btn">
							<div class="am-btn am-btn-danger" id="saveInfo">保存修改</div>
						</div>

					</form>
				</div>
			</div>
		</div>
		<!--底部-->
		<div class="footer">
			<div class="footer-hd">
				<p>
					<a href="#">恒望科技</a>
					<b>|</b>
					<a href="/index/index/index">商城首页</a>
					<b>|</b>
					<a href="#">支付宝</a>
					<b>|</b>
					<a href="#">物流</a>
				</p>
			</div>
			<div class="footer-bd">
				<p>
					<a href="#">关于恒望</a>
					<a href="#">合作伙伴</a>
					<a href="#">联系我们</a>
					<a href="#">网站地图</a>
					<em>© 2015-2025 Hengwang.com 版权所有</em>
				</p>
			</div>
		</div>
	</div>

	<aside class="menu">
		<ul>
			<li class="person active">
				<a href="/index/person/index"><i class="am-icon-user"></i>个人中心</a>
			</li>
			<li class="person">
				<p><i class="am-icon-newspaper-o"></i>个人资料</p>
				<ul>
					<li><a href="/index/person/information">个人信息</a></li>
					<li><a href="/index/person/password">安全设置</a></li>
					<li><a href="/index/person/address">地址管理</a></li>
					<li><a href="#">快捷支付</a></li>
				</ul>
			</li>
			<li class="person">
				<p><i class="am-icon-balance-scale"></i>我的交易</p>
				<ul>
					<li><a href="/index/person/order">订单管理</a></li>
					<li><a href="#">退款售后</a></li>
					<li><a href="#">评价商品</a></li>
				</ul>
			</li>
			<li class="person">
				<p><i class="am-icon-dollar"></i>我的资产</p>
				<ul>
					<li><a href="#">我的积分</a></li>
					<li><a href="#">优惠券 </a></li>
					<li><a href="#">红包</a></li>
					<li><a href="#">账户余额</a></li>
					<li><a href="#">账单明细</a></li>
				</ul>
			</li>

			<li class="person">
				<p><i class="am-icon-tags"></i>我的收藏</p>
				<ul>
					<li><a href="#">收藏</a></li>
					<li><a href="#">足迹</a></li>
				</ul>
			</li>

			<li class="person">
				<p><i class="am-icon-qq"></i>在线客服</p>
				<ul>
					<li><a href="#">商品咨询</a></li>
					<li><a href="#">意见反馈</a></li>

					<li><a href="#">我的消息</a></li>
				</ul>
			</li>
		</ul>

	</aside>
</div>
</body>
<script>
    $(function () {

        //获取昵称------------------------------------
        var nickFlag = false;		//用户名标记

        var Onick = null;	//保存用户名
        $('#user-name1').blur(function () {
            if ($('#user-name1').val().length < 3) {
                $('#user-name1Tip').text('用户名太短').css('color', 'red');
                nickFlag = false;
            } else if ($('#user-name1').val().length > 10) {
                $('#user-name1Tip').text('用户名太长').css('color', 'red');
                nickFlag = false;
            } else if ($('#user-name1').val() == parseInt($('#user-name1').val())){
                $('#user-name1Tip').text('用户名不能为纯数字').css('color', 'red');
                nickFlag = false;
            } else {
                Onick = $('#user-name1').val();
                $.post('nameCheck', {name: Onick}, success, 'json');
			}
        });
        $('#user-name1').focus(function () {
            $('#user-name1Tip').text('');
        });

        //获取真实姓名------------------------------------
        var nameFlag = false;		//用户名标记

        var Oname = null;	//保存用户名
        $('#user-name2').blur(function () {
            if ($('#user-name2').val().length < 3) {
                $('#user-name2Tip').text('姓名太短').css('color', 'red');
                nameFlag = false;
            } else if ($('#user-name2').val().length > 10) {
                $('#user-name2Tip').text('姓名太长').css('color', 'red');
                nameFlag = false;
            } else {
                Oname = $('#user-name2').val();
                nameFlag = true;
            }
        });
        $('#user-name2').focus(function () {
            $('#user-name2Tip').text('');
        });

        //获取性别-----------------------------------------
        var sexFlag = false; 	//性别标记

        var sex = null;		//性别
        $('input:radio').click(function () {
            if ($('input:radio[name="radio10"]:checked').val() == 'male') {
                sex = 1;
            }
            if ($('input:radio[name="radio10"]:checked').val() == 'female') {
                sex = 2;
            }
            if ($('input:radio[name="radio10"]:checked').val() == 'secret') {
                sex = 0;
            }
            sexFlag = true;
        });

        //获取生日--------------------------------------------
        var birthFlag = false;	//生日标记

        var year = null;
        var month = null;
        var day = null;
        var birthday = null;		//生日
        $("#year").change(function () {
            year = $('#year').val();
        });
        $('#month').change(function () {
            month = $('#month').val();
            if (month.length < 10) {
                month = '0' + month;
            }
        });
        $('#day').change(function () {
            day = $('#day').val();
            if (day.length < 10) {
                day = '0' + day;
            }
            birthday = year + month + day;
            var Now = new Date();
            var oyear = Now.getFullYear();
            var omonth = Now.getMonth() + 1;
            if (omonth < 10) {
                omonth = '0' + omonth;
            }
            var oday = Now.getDate();
            if (oday < 10) {
                oday = '0' + oday;
            }
            var Onow = oyear + '' + omonth + oday;
//            console.log(birthday, Onow);
            if (birthday > Onow) {
                $('#birthTip').text('生日有误').css('color', 'red');
                birthFlag = false;
            } else {
                birthFlag = true;
                $('#birthTip').text('生日可用').css('color', 'blue');
            }
        });

        //电话------------------------------------------------------------
        var telFlag = false;	//电话标记

        var tel = null;
        var reg = /^[1][3,4,5,7,8][0-9]{9}$/;
        $('#user-phone').blur(function () {

            tel = $('#user-phone').val();
            if ((tel.length == 11) && (parseInt(tel) == tel) && reg.test(tel)) {
                $.post('telCheck', {phone: tel}, success, 'json');
            } else {
                $('#telTip').text('号码有误').css('color', 'red');
                telFlag = false;
			}
        });
		$('#user-phone').focus(function () {
			$('#telTip').text('');
        });

		//验证邮箱-----------------------------------------
		var emailFlag = false;

		var email = null;
		$('#user-email').blur(function () {
            var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
            email = $('#user-email').val() + '';
            if (!reg.test(email)) {
                $('#emailTip').text('邮箱格式有误').css('color', 'red');
                emailFlag = false;
            } else {
                $.post('emailCheck', {email: email}, success, 'json');
			}
        });
		$('#user-email').focus(function () {
			$('#emailTip').text('');
        });

		//提交修改信息--------------------------
		$('#saveInfo').click(function () {
		    console.log(nickFlag, nameFlag, sexFlag, birthFlag, telFlag, emailFlag);
			if (nickFlag && nameFlag && sexFlag && birthFlag && telFlag && emailFlag) {
			    $.post('upInfo', {nick: Onick, name: Oname, sex: sex, birthday: birthday, tel: tel, email: email}, success, 'json');
			} else {

			    alert('请检查信息');
			    return false;
			}
        });

        function success(data) {
            switch (data.value) {
                case 1:
                    $('#user-name1Tip').text('用户名已存在').css('color', 'red');
                    nickFlag = false;
                    break;
                case 2:
                    $('#user-name1Tip').text('用户名可用').css('color', 'blue');
                    nickFlag = true;
                    break;
                case 3:
                    $('#telTip').text('号码已占用').css('color', 'red');
                    telFlag = false;
                    break;
				case 4:
				    $('#telTip').text('号码可用').css('color', 'blue');
				    telFlag = true;
				    break;
				case 5:
				    $('#emailTip').text('邮箱已占用').css('color', 'red');
				    emailFlag = false;
				    break;
				case 6:
				    $('#emailTip').text('邮箱可用').css('color', 'blue');
				    emailFlag = true;
				    break;
				case 7:
				    alert('信息修改成功');
				    nickFlag = false;
				    window.location.href = '/index/person/information';
				    break;
				case 8:
				    nickFlag = false;
				    alert('修改失败');
				    break;

            }
        }

    });
</script>
</html>